package Facade;

import java.sql.ClientInfoStatus;
import java.util.ArrayList;

public class GeneralSwitchFacade {
    private ArrayList lights;
    private Fan fan;
    private AirCondition ac;
    private Television tv;

    public GeneralSwitchFacade()
    {
        lights = new ArrayList<Light>();
        lights.add(new Light("客厅"));
        lights.add(new Light("卧室"));
        lights.add(new Light("卫生间"));
        lights.add(new Light("厨房"));
        fan = new Fan();
        ac = new AirCondition();
        tv = new Television();
    }
    public void on()
    {
        for(Object light : lights)
        {
            ((Light)light).on();
        }
        fan.on();
        ac.on();
        tv.on();
    }
    public void off()
    {
        for(Object light : lights)
        {
            ((Light)light).off();
        }
        fan.off();
        ac.off();
        tv.off();
    }

}
